/**
 * [badge 全局气泡数量提示]
 * @Author: Fu Xiaochun
 * @Email:  fuzhengchun@ling1.org
 */

export default {
    state: {
        badge: {
            check_task: 0, // 审批任务
            report: 0,     // 投诉
            arbitration: 0, // 仲裁维权
            user_abnormal: 0, // 异常用户
            cash: 0    // 用户提现
        }
    },
    getters: {
        badge: state => state.badge,
        taskNum: state => {
            let badge = state.badge;
            return parseInt(badge.check_task) + parseInt(badge.report) + parseInt(badge.arbitration) + parseInt(badge.user_abnormal);
        },
        task: state=>{
            let badge = state.badge;
            return {
                check_task: badge.check_task,
                report: badge.report,
                arbitration: badge.arbitration,
                user_abnormal: badge.user_abnormal,
            };
        },
        capital: state => {
            return {
                cash: state.badge.cash
            };
        },
    },
    mutations: {
        updateBadge(state, badge){
            state.badge = {...badge};
        },
    },
    actions: {

    }
};